#!/bin/sh

uci -q batch <<-EOF >/dev/null
	set uhttpd.main.script_timeout="360"
	commit uhttpd
	delete ucitrack.@dockerman[-1]
	add ucitrack dockerman
	set ucitrack.@dockerman[-1].exec='/etc/init.d/dockerman start'
	commit ucitrack
EOF
[ -x "$(which dockerd)" ] && chmod +x /etc/init.d/dockerman && /etc/init.d/dockerd disable && /etc/init.d/dockerman enable >/dev/null 2>&1
sed -i 's/self:cfgvalue(section) or {}/self:cfgvalue(section) or self.default or {}/' /usr/lib/lua/luci/view/cbi/dynlist.htm
/etc/init.d/uhttpd restart >/dev/null 2>&1
rm -fr /tmp/luci-indexcache /tmp/luci-modulecache >/dev/null 2>&1
exit 0
